<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ question.question_text }} - 量子投票系统</title>
    <style>
        :root {
            --primary-color: #0ff0fc;
            --secondary-color: #ff2a6d;
            --error-color: #ff2a6d;
            --success-color: #2dff7b;
            --dark-bg: #0d0221;
            --darker-bg: #070116;
            --text-color: #d1f7ff;
            --border-radius: 4px;
            --box-shadow: 0 0 15px rgba(0, 255, 252, 0.3);
            --neon-glow: 0 0 10px rgba(0, 255, 252, 0.8), 0 0 20px rgba(0, 255, 252, 0.6);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        body {
            font-family: 'Orbitron', 'Segoe UI', sans-serif;
            line-height: 1.6;
            color: var(--text-color);
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background-color: var(--dark-bg);
            background-image: 
                radial-gradient(circle at 25% 25%, rgba(15, 240, 252, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 75% 75%, rgba(255, 42, 109, 0.1) 0%, transparent 50%);
            position: relative;
            overflow-x: hidden;
        }

        body::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: 
                linear-gradient(135deg, transparent 49.5%, var(--primary-color) 49.5%, var(--primary-color) 50.5%, transparent 50.5%),
                linear-gradient(45deg, transparent 49.5%, var(--primary-color) 49.5%, var(--primary-color) 50.5%, transparent 50.5%);
            background-size: 30px 30px;
            opacity: 0.05;
            pointer-events: none;
            z-index: -1;
        }

        .vote-container {
            background: rgba(13, 2, 33, 0.7);
            border-radius: var(--border-radius);
            box-shadow: var(--box-shadow);
            padding: 30px;
            margin-top: 20px;
            border: 1px solid rgba(0, 255, 252, 0.2);
            backdrop-filter: blur(5px);
            position: relative;
            overflow: hidden;
            transition: var(--transition);
        }

        .vote-container:hover {
            box-shadow: var(--neon-glow);
            transform: translateY(-3px);
        }

        .vote-container::before {
            content: "";
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(
                to bottom right,
                transparent 45%,
                rgba(0, 255, 252, 0.1) 50%,
                transparent 55%
            );
            transform: rotate(45deg);
            pointer-events: none;
        }

        h1 {
            color: var(--primary-color);
            margin-bottom: 25px;
            font-size: 1.8rem;
            text-align: center;
            text-shadow: 0 0 10px rgba(0, 255, 252, 0.5);
            letter-spacing: 1px;
            position: relative;
            padding-bottom: 15px;
        }

        h1::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 100px;
            height: 3px;
            background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
            box-shadow: var(--box-shadow);
        }

        .error-message {
            color: var(--error-color);
            background-color: rgba(255, 42, 109, 0.1);
            padding: 12px 15px;
            border-radius: var(--border-radius);
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            border-left: 3px solid var(--error-color);
            animation: pulse 2s infinite;
            font-family: 'Courier New', monospace;
        }

        @keyframes pulse {
            0% { opacity: 0.8; }
            50% { opacity: 1; }
            100% { opacity: 0.8; }
        }

        .error-message:before {
            content: "⚠";
            display: inline-block;
            margin-right: 10px;
            font-size: 1.2rem;
        }

        .choice-list {
            list-style: none;
            padding: 0;
            margin-bottom: 30px;
        }

        .choice-item {
            margin-bottom: 15px;
            position: relative;
        }

        .radio-input {
            position: absolute;
            opacity: 0;
        }

        .radio-label {
            display: block;
            padding: 15px 20px 15px 50px;
            background-color: rgba(15, 240, 252, 0.05);
            border-radius: var(--border-radius);
            cursor: pointer;
            transition: var(--transition);
            border: 1px solid rgba(0, 255, 252, 0.3);
            position: relative;
            overflow: hidden;
        }

        .radio-label:hover {
            background-color: rgba(15, 240, 252, 0.15);
            box-shadow: var(--neon-glow);
            transform: translateY(-2px);
        }

        .radio-input:checked + .radio-label {
            background-color: rgba(15, 240, 252, 0.2);
            box-shadow: var(--neon-glow);
            border-color: var(--primary-color);
        }

        .radio-label:before {
            content: "";
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            width: 18px;
            height: 18px;
            border: 2px solid var(--primary-color);
            border-radius: 50%;
            transition: var(--transition);
        }

        .radio-input:checked + .radio-label:before {
            background-color: var(--primary-color);
            box-shadow: 0 0 10px var(--primary-color);
        }

        .submit-btn {
            display: block;
            width: 100%;
            padding: 14px;
            background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
            color: #111;
            border: none;
            border-radius: var(--border-radius);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: var(--transition);
            text-transform: uppercase;
            letter-spacing: 1px;
            position: relative;
            overflow: hidden;
            z-index: 1;
            font-family: 'Orbitron', sans-serif;
        }

        .submit-btn:hover {
            box-shadow: 0 0 20px rgba(0, 255, 252, 0.7);
            transform: translateY(-3px);
        }

        .submit-btn:before {
            content: "";
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: 0.5s;
            z-index: -1;
        }

        .submit-btn:hover:before {
            left: 100%;
        }

        .back-link {
            display: inline-block;
            margin-top: 20px;
            color: var(--primary-color);
            text-decoration: none;
            transition: var(--transition);
            font-size: 0.9rem;
            border-bottom: 1px dashed var(--primary-color);
            padding-bottom: 2px;
        }

        .back-link:hover {
            color: var(--secondary-color);
            border-bottom-color: var(--secondary-color);
            text-shadow: 0 0 5px var(--primary-color);
        }

        /* 科技感装饰元素 */
        .tech-corner {
            position: absolute;
            width: 20px;
            height: 20px;
            border-color: var(--primary-color);
            border-style: solid;
            border-width: 0;
            opacity: 0.7;
        }

        .tech-corner-tl {
            top: 10px;
            left: 10px;
            border-top-width: 2px;
            border-left-width: 2px;
        }

        .tech-corner-tr {
            top: 10px;
            right: 10px;
            border-top-width: 2px;
            border-right-width: 2px;
        }

        .tech-corner-bl {
            bottom: 10px;
            left: 10px;
            border-bottom-width: 2px;
            border-left-width: 2px;
        }

        .tech-corner-br {
            bottom: 10px;
            right: 10px;
            border-bottom-width: 2px;
            border-right-width: 2px;
        }

        @media (max-width: 640px) {
            body {
                padding: 15px;
            }
            
            .vote-container {
                padding: 20px;
            }
            
            h1 {
                font-size: 1.5rem;
            }
            
            .radio-label {
                padding: 12px 15px 12px 40px;
            }
            
            .radio-label:before {
                left: 10px;
                width: 16px;
                height: 16px;
            }
        }
    </style>
    <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
    <div class="vote-container">
        <!-- 科技感边角装饰 -->
        <div class="tech-corner tech-corner-tl"></div>
        <div class="tech-corner tech-corner-tr"></div>
        <div class="tech-corner tech-corner-bl"></div>
        <div class="tech-corner tech-corner-br"></div>

        <form action="{% url 'polls:vote' question.id %}" method="post">
            {% csrf_token %}
            <h1>{{ question.question_text }}</h1>
            
            {% if error_message %}
                <div class="error-message">
                    <strong>{{ error_message }}</strong>
                </div>
            {% endif %}
            
            <ul class="choice-list">
                {% for choice in question.choice_set.all %}
                    <li class="choice-item">
                        <input type="radio" 
                               name="choice" 
                               id="choice{{ forloop.counter }}" 
                               value="{{ choice.id }}" 
                               class="radio-input">
                        <label for="choice{{ forloop.counter }}" class="radio-label">
                            {{ choice.choice_text }}
                        </label>
                    </li>
                {% endfor %}
            </ul>
            
            <button type="submit" class="submit-btn">量子确认</button>
        </form>
        
        <a href="{% url 'polls:index' %}" class="back-link">← 返回量子投票中心</a>
    </div>

    <script>
        // 添加科技感交互效果
        document.addEventListener('DOMContentLoaded', function() {
            const form = document.querySelector('form');
            const submitBtn = document.querySelector('.submit-btn');
            const radioLabels = document.querySelectorAll('.radio-label');
            const container = document.querySelector('.vote-container');
            
            // 为每个选项添加科技感悬停效果
            radioLabels.forEach(label => {
                label.addEventListener('mouseenter', function() {
                    this.style.boxShadow = '0 0 15px rgba(0, 255, 252, 0.5)';
                });
                
                label.addEventListener('mouseleave', function() {
                    if (!this.previousElementSibling.checked) {
                        this.style.boxShadow = '';
                    }
                });
            });
            
            // 随机闪烁效果
            setInterval(() => {
                if (Math.random() > 0.95) {
                    container.style.boxShadow = '0 0 20px rgba(255, 42, 109, 0.8)';
                    setTimeout(() => {
                        container.style.boxShadow = '';
                    }, 300);
                }
            }, 3000);
            
            // 表单提交效果
            form.addEventListener('submit', function(e) {
                const selectedChoice = document.querySelector('input[name="choice"]:checked');
                
                if (!selectedChoice) {
                    e.preventDefault();
                    if (!document.querySelector('.error-message')) {
                        const errorDiv = document.createElement('div');
                        errorDiv.className = 'error-message';
                        errorDiv.innerHTML = '<strong>请选择一个选项</strong>';
                        form.insertBefore(errorDiv, form.firstChild.nextSibling);
                        
                        // 添加科技感抖动动画
                        submitBtn.style.transform = 'translateX(-5px)';
                        setTimeout(() => {
                            submitBtn.style.transform = 'translateX(5px)';
                            setTimeout(() => {
                                submitBtn.style.transform = 'translateX(0)';
                            }, 50);
                        }, 50);
                        
                        // 添加脉冲光效
                        submitBtn.style.boxShadow = '0 0 20px var(--error-color)';
                        setTimeout(() => {
                            submitBtn.style.boxShadow = '';
                        }, 300);
                    }
                } else {
                    submitBtn.textContent = '量子传输中...';
                    submitBtn.disabled = true;
                    
                    // 添加提交动画
                    submitBtn.style.background = 'linear-gradient(90deg, var(--primary-color), var(--success-color))';
                }
            });
        });
    </script>
</body>
</html>